<?php 
$v_current_style_name = "odd_row";
$v_next_style_name="";

$v_current_year = date("Y");
$v_current_month = date("m");
$v_url_send_question = "index.php?fuseaction=DISPLAY_SINGLE_QA_QUESTION_FOR_SENDING";
$v_number_of_qa = sizeof($arr_qa);
?>
<table width="100%" cellpadding="0" cellspacing="0">
	<form action="index.php" method="post" name="frm_qa_search_time">
		<input name="fuseaction" type="hidden" value="DISPLAY_ALL_QA_QUESTION_BY_TIME">
		<input type="hidden" name="year" value="<?php echo $v_year;?>">
		<input type="hidden" name="month" value="<?php echo $v_month;?>">
		<input type="hidden" name="status" value="<?php echo $v_status;?>">
	<tr class="page_title">
		<td colspan="10"><?php echo CONST_QA_SEARCH_BY_TIME_LABEL;?><small class="number_label"><?php echo "(".$v_total.")"; ?></small></td>
	</tr>
	<tr>
		<td colspan="10" align="left" class="normal_label" >
			<table width="70%" cellspacing="0" cellpadding="0">
				<tr align="left" class="normal_label">
					<td><?php echo CONST_YEAR_SELECT_LABEL; ?></td>
					<td>
						<select name="select_year" class="normal_selectbox" onChange="set_value(document.frm_qa_search_time.select_year,document.frm_qa_search_time.year);">
							<?php echo _generate_year_input(_CONST_BEGIN_YEAR,_CONST_END_YEAR,$v_current_year)?>
						</select>
					</td>
					<td><?php echo CONST_MONTH_SELECT_LABEL; ?></td>
					<td>
						<select name="select_month" class="normal_selectbox" onChange="set_value(document.frm_qa_search_time.select_month,document.frm_qa_search_time.month);">
							<?php echo _generate_year_input(1,12,$v_current_month)?>
						</select>
					</td>
					<td>
						<input type="button" class="small_button" style="width:100%" name="btn_filter" value="<?php echo CONST_SEARCH_BUTTON; ?>" onClick="show_qa_search_by_time_onClick('DISPLAY_ALL_QA_QUESTION_BY_TIME');">
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr> 
		<td class="send_qa_link" colspan="5">
			<a href="<?php echo $v_url_send_question;?>"><?php echo CONST_QA_QUESTION_FOR_ANSWER_TITLE;?></a>&nbsp;&nbsp;
			<img src="<?php echo $_ISA_IMAGE_URL_PATH?>send_qa.gif">
		</td>
	</tr>	
	<tr><td height="10pt"></td></tr>
</table>
<?php
if ($v_number_of_qa >0){?>
	<table class="list_table" width="100%" cellpadding="0" cellspacing="0">
		<col width="5%"><col width="95%">		
		<tr class="header">
			<td align="center"><?php echo CONST_QA_ORDER; ?></td>
			<td align="center"><?php echo CONST_QA_NAME_LABEL; ?></td>
		</tr><?php
			for($i=0;$i< $v_number_of_qa;$i++){//mo vong for
				$v_qa_stt = $i +1 + ($page -1) * $v_limit;
				$v_qa_id = $arr_qa[$i]['0'];
				$v_qa_name= $arr_qa[$i]['1'];		
				$v_questioner_name = $arr_qa[$i]['2'];
				$v_questioner_add= $arr_qa[$i]['3'];		
				$v_questioner_date= _yyyymmdd_to_ddmmyyyy($arr_qa[$i]['4']);		
				$v_questioner_info = "( ".$v_questioner_name;
				if (strlen(trim($v_questioner_add)) > 0){
					$v_questioner_info = $v_questioner_info . ', '.$v_questioner_add;
				}							
				$v_questioner_info = $v_questioner_info . ',  ng&#224;y '.$v_questioner_date.")";				
				$v_url = "index.php?fuseaction=DISPLAY_SINGLE_QA_QUESTION&qa_id=".$v_qa_id;	
				if ($v_current_style_name == "odd_row"){
					$v_current_style_name = "round_row";
				}else{
					$v_current_style_name = "odd_row";
				}?>		
				<tr class="<?php echo $v_current_style_name ?>"> 
					<td align="center" class="normal_label"><?php echo $v_qa_stt;?>	</td>				
					<td align="left">
					<img src="<?php echo $_ISA_IMAGE_URL_PATH?>doc.gif">
						<a class="normal_label" href="<?php echo $v_url; ?>"><?php echo $v_qa_name;?><small class="normal_label"><?php echo $v_questioner_info;?></small></a>&nbsp;
					</td>					
				</tr><?php
			}//end for	
			if ($v_current_style_name == "odd_row"){
				$v_next_style_name = "round_row";
			}else{
				$v_next_style_name = "odd_row";
			}
			echo _add_empty_row($v_number_of_qa,CONST_LIMIT_QA_PER_PAGE,$v_current_style_name,$v_next_style_name,2);?>								
	</table><?php
	if ($v_total > $v_limit){ ?>
		<table>
			<tr><td height="10pt"></td></tr>
			<tr>
				<col width="5%"><col width="95%">
				<td align="center" class="normal_label">
				<b><?php
				if ($page == 1)  
					echo "<img src=" . $_ISA_IMAGE_URL_PATH . "d-arrow-left.jpg class=normal_image align=center>"; 
				else            
					echo "<a href=\"index.php?fuseaction=DISPLAY_ALL_QA_QUESTION_BY_TIME&v_session=".$v_session."&year=".$v_year."&month=".$v_month."&status=".$v_status. "&page=".($page - 1). "\">". "<img src=" . $_ISA_IMAGE_URL_PATH . "arrow-left.jpg class=normal_image align=center>" . "</a>";
				
				for ($i = 1; $i <= $pager->numPages; $i++) { 
					echo " | "; 
					if ($i == $pager->page)
						echo $i; 
					else 
						 echo "<a href=\"index.php?fuseaction=DISPLAY_ALL_QA_QUESTION_BY_TIME&v_session=".$v_session."&year=".$v_year."&month=".$v_month."&status=".$v_status. "&page=". $i. "\">". $i."</a>";
				}//END for
				
				if ($page == $pager->numPages) 
					echo " | ". "<img src=" . $_ISA_IMAGE_URL_PATH . "d-arrow-right.jpg class=normal_image align=center>"; 
				else            
					echo " | ". "<a href=\"index.php?fuseaction=DISPLAY_ALL_QA_QUESTION_BY_TIME&v_session=".$v_session."&year=".$v_year."&month=".$v_month."&status=".$v_status. "&page=".($page + 1) . "\">" . "<img src=" . $_ISA_IMAGE_URL_PATH . "arrow-right.jpg class=normal_image align=center>" . "</a>";?>
				</b>
				</td>
			</tr>
		</table><?php
	}
}else{ ?>
		<small class="normal_label"><?php echo CONST_NO_QA_MESSAGE; ?></small><?php
}?>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr><td height="10pt"></td></tr>
	<tr align="center">
		<td><input Type="button" Name="btn_back" class="normal_button" value="<?php echo _CONST_BACK_BUTTON;?>" onClick="goback();"></td>
	</tr>
</form>		
</table>
<script>
	set_selected(document.frm_qa_search_time.select_year,"<? echo $v_year;?>");
	set_selected(document.frm_qa_search_time.select_month,"<? echo $v_month;?>");
</script>

